import api from './index'
import { axios } from '@/utils/request'

export function login(parameter) {
  return axios({
    url: '/api/index/adminlogin',
    method: 'post',
    data: parameter
  })
}

export function loginByToken(parameter) {
  return axios({
    url: '/api/cloud/login_by_token',
    method: 'post',
    data: parameter
  })
}

export function getBindUser(parameter) {
  return axios({
    url: '/api/cloud/get_bind_user',
    method: 'get',
    param: parameter
  })
}

export function cloudProxy(parameter) {
  return axios({
    url: '/api/cloud/cloud_proxy',
    method: 'post',
    data: parameter
  })
}

export function getSmsCaptcha(parameter) {
  return axios({
    url: api.SendSms,
    method: 'post',
    data: parameter
  })
}

export function getInfo() {
  return axios({
    url: '/adminapi/index/userinfo',
    method: 'get',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

export function logout() {
  return axios({
    url: '/adminapi/index/logout',
    method: 'post',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

export function get2step(parameter) {
  return axios({
    url: api.twoStepCode,
    method: 'post',
    data: parameter
  })
}